/**
 * Copyright (c) 2009  Collaborative Development Group, C.S. Dept., University of Bari
 *
 * All rights reserved. This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License v1.0  which accompanies this distribution, and is 
 * available at http://www.eclipse.org/legal/epl-v10.html
 */
package it.uniba.di.cdg.penelope.ui.mvp.test;

import static it.uniba.di.cdg.penelope.events.IEventHelper.APP_EVENT;

import it.uniba.di.cdg.penelope.events.OnEvent;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import org.osgi.service.event.Event;
import org.osgi.service.event.EventHandler;
import it.uniba.di.cdg.penelope.events.*;

import it.uniba.di.cdg.penelope.ui.annotation.PresentationModel;
import it.uniba.di.cdg.penelope.ui.IPresentationModel;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;

/**
 * Intercept setters.
 */
public aspect PresentationModelEnhancerAspect {
	declare parents: (@PresentationModel *) implements IPresentationModel;

	private PropertyChangeSupport IPresentationModel.propertyChangeSupport = new PropertyChangeSupport( this );
	
	public void IPresentationModel.addPropertyChangeListener( PropertyChangeListener listener ) {
		propertyChangeSupport.addPropertyChangeListener( listener );
	}
	
	public void IPresentationModel.addPropertyChangeListener( String propertyName, PropertyChangeListener listener ) {
		propertyChangeSupport.addPropertyChangeListener( propertyName, listener );
	}
	
	public void IPresentationModel.removePropertyChangeListener( PropertyChangeListener listener ) {
		propertyChangeSupport.removePropertyChangeListener( listener );
	}
	
	/**
	 * Notify property change.
	 * @param propertyName
	 * @param oldValue
	 * @param newValue
	 */
	private void IPresentationModel.firePropertyChange( String propertyName, Object oldValue, Object newValue ) {
		propertyChangeSupport.firePropertyChange( propertyName, oldValue, newValue );
	}
}
